# open第二个参数如果为w,代表写入,会将原始文件的内容覆盖
with open('test_write.txt', 'w') as write_file:
    hello = "你好！"
    write_file.write(hello)

# 如果想要在原始文本不变的情况下添加新的内容,则使用a模式
with open('test_write.txt', 'a') as write_file:
    hello = "你好！"
    write_file.write(hello)